﻿Public Class clCombate
    Private _heroe As clHeroe
    Private _monstruo As clMonstruo
    'Public Sub New(ByVal heroe As clHeroe, ByVal enemigo As clMonstruo)
    '    Me._heroe = heroe
    '    Me._monstruo = _monstruo
    'End Sub
    Public Function Ataque(ByVal ataque1 As Decimal, ByVal power_up As Decimal) As Decimal
        Dim daño_final As Decimal
        daño_final = ataque1 + power_up
        If Me.Fallo = True Then
            Return 0
        End If
        Return daño_final
    End Function
    'Public Function Daño_Magico(ByVal dañoMagico As Decimal, ByVal resistencia As Decimal, ByVal power_up As Decimal) As Decimal
    '    Dim daño As Decimal
    '    daño = dañoMagico + power_up - resistencia
    '    If Me.Fallo = True Then
    '        Return 0<
    '    End If
    '    Return daño
    'End Function
    Public Function Defensa(ByVal defensa1 As Decimal, ByVal power_up As Decimal) As Decimal
        Dim defensa_final As Decimal
        defensa_final = defensa1 + power_up
        If Me.Fallo = True Then
            Return defensa1
        End If
        Return defensa_final
    End Function

    Public Function Vida(ByVal vida1 As Decimal, ByVal power_up As Decimal) As Decimal
        Dim vida_final As Decimal
        vida_final = vida1 + power_up
        If Me.Fallo = True Then
            Return vida1
        End If
        Return vida_final
    End Function

    Public Function Velocidad(ByVal velocidad1 As Decimal, ByVal power_up As Decimal) As Decimal
        Dim velocidad_final As Decimal
        velocidad_final = velocidad1 + power_up
        If Me.Fallo = True Then
            Return velocidad1
        End If
        Return velocidad_final
    End Function

    Public Function Fallo() As Boolean
        Dim aleator As New Random
        Dim resultado As Integer
        resultado = aleator.Next(9)
        If resultado = 0 Then Return True ' si sale true falla el ataque
        Return False ' hace pupita :'(
    End Function
    Public Function Perder() As Boolean ' si el heroe sigue vivo continuas luchando
        If _heroe.Vivo = True Then Return False
        Return True
    End Function
    'Public Function Ganar() As Boolean
    '    If _monstruo.Vivo = False Then
    '        _heroe.Añadir_Objetos(_monstruo.Vencido(_monstruo))
    '        Return True
    '    End If
    '    Return False
    'End Function

End Class
